import { createRouter, createWebHistory } from 'vue-router';

import Home from '../views/Home.vue';
import Login from '../views/Login.vue';
import Register from '../views/Register.vue';
import ProjectList from '../views/ProjectList.vue';
import VoteResult from '../views/VoteResult.vue';
import PostPlatform from '../views/PostPlatform.vue';
import UserCenter from '../views/UserCenter.vue';

// 管理员端
import AdminDashboard from '../views/admin/AdminDashboard.vue';
import StudentManage from '../views/admin/StudentManage.vue';
import TeacherManage from '../views/admin/TeacherManage.vue';
import ProjectManage from '../views/admin/ProjectManage.vue';
import VoteManage from '../views/admin/VoteManage.vue';
import StatisticManage from '../views/admin/StatisticManage.vue';
import FinanceManage from '../views/admin/FinanceManage.vue';
import PostManage from '../views/admin/PostManage.vue';

// 教师端
import TeacherDashboard from '../views/teacher/TeacherDashboard.vue';
import TeacherProject from '../views/teacher/TeacherProject.vue';
import TeacherVote from '../views/teacher/TeacherVote.vue';
import TeacherAssessment from '../views/teacher/TeacherAssessment.vue';
import TeacherFinish from '../views/teacher/TeacherFinish.vue';
import TeacherStatistic from '../views/teacher/TeacherStatistic.vue';

const routes = [
  { path: '/', component: Home },
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/projects', component: ProjectList },
  { path: '/vote-result', component: VoteResult },
  { path: '/post-platform', component: PostPlatform },
  { path: '/user-center', component: UserCenter },
  // 管理员端
  { path: '/admin', component: AdminDashboard, children: [
    { path: 'students', component: StudentManage },
    { path: 'teachers', component: TeacherManage },
    { path: 'projects', component: ProjectManage },
    { path: 'votes', component: VoteManage },
    { path: 'statistics', component: StatisticManage },
    { path: 'finances', component: FinanceManage },
    { path: 'posts', component: PostManage },
  ]},
  // 教师端
  { path: '/teacher', component: TeacherDashboard, children: [
    { path: 'projects', component: TeacherProject },
    { path: 'votes', component: TeacherVote },
    { path: 'assessments', component: TeacherAssessment },
    { path: 'finishes', component: TeacherFinish },
    { path: 'statistics', component: TeacherStatistic },
  ]},
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router; 